#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include "src/symbols/wubi/wubi_symbol.h"
#include "src/core/semantic_engine/semantic_reasoner.h"
#include "src/core/evolution/autonomous_learner.h"

namespace py = pybind11;

PYBIND11_MODULE(aika_seh_wubi, m) {
    m.doc() = "AIKA-SEH-WuBi: Semantic-Enhanced Hierarchical WuBi Symbol System";
    
    // WuBiSymbol类绑定
    py::class_<WuBiSymbol>(m, "WuBiSymbol")
        .def(py::init<const std::string&, const std::string&>())
        .def("get_code", &WuBiSymbol::getCode)
        .def("get_character", &WuBiSymbol::getCharacter)
        .def("get_radicals", &WuBiSymbol::getRadicals)
        .def("compute_semantic_vector", &WuBiSymbol::computeSemanticVector)
        .def("similarity", &WuBiSymbol::similarity)
        .def("__str__", &WuBiSymbol::toString);
    
    // SemanticVector类绑定
    py::class_<SemanticVector>(m, "SemanticVector")
        .def("__add__", &SemanticVector::operator+)
        .def("__mul__", &SemanticVector::operator*)
        .def("cosine_similarity", &SemanticVector::cosineSimilarity);
    
    // SemanticReasoningResult类绑定
    py::class_<SemanticReasoningResult>(m, "SemanticReasoningResult")
        .def_readonly("inferred_symbols", &SemanticReasoningResult::inferredSymbols)
        .def_readonly("activated_knowledge", &SemanticReasoningResult::activatedKnowledge)
        .def_readonly("confidence", &SemanticReasoningResult::confidence);
    
    // SemanticReasoner类绑定
    py::class_<SemanticReasoner>(m, "SemanticReasoner")
        .def(py::init<>())
        .def("reason", &SemanticReasoner::reason);
    
    // AutonomousLearner类绑定
    py::class_<AutonomousLearner>(m, "AutonomousLearner")
        .def(py::init<>())
        .def("autonomous_learning_loop", &AutonomousLearner::autonomousLearningLoop);
}